Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Eng 50] | Dao creation network switch #2645

Merged
merged 2 commits into from
Jan 6, 2025

Conversation

Da-Colon
Copy link
Contributor

@Da-Colon Da-Colon commented Dec 20, 2024

Closes https://linear.app/decent-labs/issue/ENG-50/dev-error-creating-an-nft-dao

So the problem is that I placed the useEffect within the EstablishEssentials form rather than higher up.

This move makes it if the User switches there network at some point later in the process, the app switches it back keeping the user on the selected network.

I did attempt to move this selection and network check to the button, but with the current setup within useBuildDAOTx where it pulls contracts from useNetworkConfigStore in which is set to the current network.

A future refactor will be needed to confirm to a new pattern of more fine control over what network the DAO is deployed on.

Testing:

  • Enter Create DAO workflow
  • Select Different network from etherem
  • Go to end of which DAO creation workflow you are on.
  • Before deploying, open wallet and manually switch wallet network
  • Go back to page (focus on page), go back to wallet and network should be back to the originally selected network.

Basically our now app now prevents the user from manually switching thier network via wallet during this workflow. Not ideal to be so connected to that network. but without some refactoring how the contracts for deployment are chosen this is the most effective method to ensure proper deployment

Copy link

linear bot commented Dec 20, 2024

Copy link

netlify bot commented Dec 20, 2024

Deploy Preview for decent-interface-dev ready!

Name Link
🔨 Latest commit 96b63e3
🔍 Latest deploy log https://app.netlify.com/sites/decent-interface-dev/deploys/6765990956b3260008f9b6c0
😎 Deploy Preview https://deploy-preview-2645.app.dev.decentdao.org
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@johnqh johnqh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested against Coinbase and TokenPocket wallet extensions. CB works fine because when the app request the wallet to change network, it just does it. TP has a little problem.

Steps:

  1. Connect TP wallet with Ethereum selected.
  2. Create a DAO in our app. Select "Sepolia" as the network.
  3. Note, TP shows prompt to change network. If you click "Cancel", it keeps on prompting. Click on "Confirm" now.
  4. Click "Next"
  5. In TP, switch network back to "Ethereum". Note, immediately, it shows a badge with "1" label. If you click on it, it is asking you to switch back to Sepolia. However, the badge is not super obvious and user may miss it.
  6. Create NFT DAO with 0x31408f226E37FBF8715CA6eE45aaB4Ea213bA7A5 as address (this issue should happen with ERC-20 DAO too). You will see the address is red with error because it is now using Ethereum mainNet to check the address.

Conclusion, there are many wallet variations and different network switching flows, that may still cause two source of truth in our app.

I think we should ignore the wallet network selection during our flow, and only prompt the wallet to switch network at signing (so only one source of truth with user selected network in the app)

@Da-Colon
Copy link
Contributor Author

Da-Colon commented Jan 2, 2025

Tested against Coinbase and TokenPocket wallet extensions. CB works fine because when the app request the wallet to change network, it just does it. TP has a little problem.

Steps:

  1. Connect TP wallet with Ethereum selected.
  2. Create a DAO in our app. Select "Sepolia" as the network.
  3. Note, TP shows prompt to change network. If you click "Cancel", it keeps on prompting. Click on "Confirm" now.
  4. Click "Next"
  5. In TP, switch network back to "Ethereum". Note, immediately, it shows a badge with "1" label. If you click on it, it is asking you to switch back to Sepolia. However, the badge is not super obvious and user may miss it.
  6. Create NFT DAO with 0x31408f226E37FBF8715CA6eE45aaB4Ea213bA7A5 as address (this issue should happen with ERC-20 DAO too). You will see the address is red with error because it is now using Ethereum mainNet to check the address.

Conclusion, there are many wallet variations and different network switching flows, that may still cause two source of truth in our app.

I think we should ignore the wallet network selection during our flow, and only prompt the wallet to switch network at signing (so only one source of truth with user selected network in the app)

Let's discussed this on a call when available.

@johnqh
Copy link
Contributor

johnqh commented Jan 6, 2025

Another related issue: When connected to Wallet Connect (Metamask), switching the network in app causes the MM wallet to repeatedly prompt to switch network to the point of wallet not usable.

@johnqh
Copy link
Contributor

johnqh commented Jan 6, 2025

As discussed, I will approve it and create new ticket for follow-up to deal with network switching

@johnqh johnqh self-requested a review January 6, 2025 17:40
Copy link
Contributor

@johnqh johnqh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed about single source of truth. Creating a new ticket to handle the others

@adamgall adamgall self-requested a review January 6, 2025 17:42
@Da-Colon Da-Colon merged commit 5b85b67 into develop Jan 6, 2025
7 checks passed
@Da-Colon Da-Colon deleted the eng-50/dao-creation-network-switch branch January 6, 2025 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants